﻿Type=Activity
Version=2.71
@EndOfDesignText@
#Region  Activity Attributes 
	#FullScreen: False
	#IncludeTitle: True
#End Region

Sub Process_Globals
	'These global variables will be declared once when the application starts.
	'These variables can be accessed from all modules.
	
	Dim V_XM As String
	Dim V_XB As String
	Dim V_NL As String
	Dim V_CH As String
	Dim V_BHID As Int
	Dim V_RYRQ As Int
	Dim V_CYRQ As Int
	
End Sub

Sub Globals

	Dim lsvXM As ListView
	Dim Barcode As ABZxing
End Sub

Sub Activity_Create(FirstTime As Boolean)
	Activity.LoadLayout("FormXMList")

	InitLayOut
	
End Sub

Sub Activity_Resume
	RefreshData
End Sub

Sub Activity_Pause (UserClosed As Boolean)

End Sub

Sub InitLayOut
	lsvXM.AddTwoLines2("体征测量","记录病人的体温、脉搏、血压等信息",0)
	lsvXM.AddTwoLines2("执行单","查询病人的护理信息与记录执行信息",1)
	
	lsvXM.AddTwoLines2("信息查询","查询病人的各类信息",9)
	
'	lsvXM.AddTwoLines2("基本信息","查询病人的基本信息",11)
'	lsvXM.AddTwoLines2("护理记录信息","查询病人的护理记录信息",12)
'	lsvXM.AddTwoLines2("病历文书信息","查询病人的病历文书信息",13)
'	lsvXM.AddTwoLines2("医嘱信息","查询病人的医嘱信息",14)
'	lsvXM.AddTwoLines2("检验信息","查询病人的检验信息",15)
'	lsvXM.AddTwoLines2("检查信息","查询病人的检查信息",16)
'	lsvXM.AddTwoLines2("诊断信息","查询病人的诊断信息",17)
'	lsvXM.AddTwoLines2("费用信息","查询病人的费用信息",18)
	
	lsvXM.FastScrollEnabled = True
	
	'高级菜单
	Activity.AddMenuItem("扫描定位","MenuItemAdv")
	Activity.AddMenuItem("手工定位","MenuItemAdv")
	Activity.AddMenuItem("登陆科室","MenuItemAdv")
End Sub

Sub MenuItemAdv_Click
	If Sender = "手工定位" Then
		StartActivity("BHSearch")
		
	Else If Sender = "扫描定位" Then
		BHScan 	

	Else If Sender = "登陆科室" Then
		StartActivity("LoginKS") 
	End If
	
End Sub

Sub RefreshData
	Activity.Title = "功能列表-" & V_CH & " " &V_XM 
End Sub

Sub lsvXM_ItemClick (Position As Int, Value As Object)
	If Value = 0 Then
		BHTWDEdit.V_BHID = V_BHID
		BHTWDEdit.V_CH = V_CH
		BHTWDEdit.V_XM = V_XM
		StartActivity("BHTWDEdit")  '体征测量
		
	End If 
'	If Value = 0 Then
'		BHRYInfo.V_BHID = V_BHID
'		BHRYInfo.V_CH = V_CH
'		BHRYInfo.V_XM = V_XM
'		StartActivity("BHRYInfo")  '基本信息
'	Else If Value = 1 Then
'		BHZDInfo.V_BHID = V_BHID
'		BHZDInfo.V_CH = V_CH
'		BHZDInfo.V_XM = V_XM
'		StartActivity("BHZDInfo")  '诊断信息
'	Else If Value = 2 Then
'		BHYZInfo.V_BHID = V_BHID
'		BHYZInfo.V_CH = V_CH
'		BHYZInfo.V_XM = V_XM
'		StartActivity("BHYZInfo")  '医嘱信息		
'	Else If Value = 3 Then
'		BHHLInfo.V_BHID = V_BHID
'		BHHLInfo.V_CH = V_CH
'		BHHLInfo.V_XM = V_XM
'		BHHLInfo.V_RYRQ = V_RYRQ
'		StartActivity("BHHLInfo")  '护理记录信息	
'	Else If Value = 4 Then
'		BHJYInfo.V_BHID = V_BHID
'		BHJYInfo.V_CH = V_CH
'		BHJYInfo.V_XM = V_XM
'		StartActivity("BHJYInfo")  '检验信息			
'	Else If Value = 5 Then
'		BHJCInfo.V_BHID = V_BHID
'		BHJCInfo.V_CH = V_CH
'		BHJCInfo.V_XM = V_XM
'		StartActivity("BHJCInfo")  '检查信息			
'	Else If Value = 6 Then
'		BHFYInfo.V_BHID = V_BHID
'		BHFYInfo.V_CH = V_CH
'		BHFYInfo.V_XM = V_XM
'		BHFYInfo.V_RYRQ = V_RYRQ
'		BHFYInfo.V_CYRQ = V_CYRQ
'		StartActivity("BHFYInfo")  '费用信息		
'	Else If Value = 7 Then
'		BHBLInfo.V_BHID = V_BHID
'		BHBLInfo.V_CH = V_CH
'		BHBLInfo.V_XM = V_XM
'		StartActivity("BHBLInfo")  '病历文书信息			
'	End If
End Sub

Sub BHScan
	Barcode.ABGetBarcode("Barcode", "")

End Sub

Sub Barcode_BarcodeFound(ABarcode As String, AFormatName As String)
	Dim mapResult As Map
	Dim sZYH As String 
	sZYH = ABarcode.ToUpperCase
	
	sZYH = sZYH.Replace("G","")
	sZYH = sZYH.Replace("R","")
	
  mapResult = SearchBH(sZYH)
	If mapResult<> Null Then
		ProgressDialogHide
		ToastMessageShow("找到该住院号:"&sZYH, True)			
		GoXMList(mapResult)	
	Else
		ProgressDialogHide
		ToastMessageShow("找不到该住院号:"&sZYH, True)		
	End If

End Sub

Sub Barcode_Canceled()
	ProgressDialogHide
	ToastMessageShow("取消扫描", True)
	
End Sub

Sub SearchBH(AZYH As String) As Map
	Dim mapResult As Map
	Dim sZYH As String
	
	mapResult = Null
	
	For i = 0 To BHList.FBHData.Size - 1 
		mapResult = BHList.FBHData.Get(i)
		sZYH = mapResult.Get("ZYH")
		If sZYH = AZYH Then
			Exit
		End If
	Next
	Return mapResult
End Sub

Sub GoXMList(ABHMap As Map)
	Dim sCYRQ As String
	If ABHMap<>Null Then
		V_BHID = ABHMap.Get("BHID")
		V_CH = ABHMap.Get("CH")
		V_XM = ABHMap.Get("XM")
		V_XB = ABHMap.Get("XB")
		V_NL = ABHMap.Get("NL")
		V_RYRQ = ABHMap.Get("RYRQ")
		
		sCYRQ = ABHMap.Get("CYRQ")
		If sCYRQ ="" Then
			V_CYRQ = 0
		Else
			V_CYRQ = sCYRQ
		End If
		
		RefreshData	
	
	End If

End Sub